<?php
	mysql_connect($globalDatabaseServer, $globalDatabaseUser, $globalDatabasePassword);
	mysql_select_db($globalDatabaseDatabase);
	
	function databaseGetQueuedEmails() {
		$query = mysql_query("SELECT * FROM emails WHERE sent is NULL");
		$result = array();
		while ($data = @mysql_fetch_assoc($query)) {
			$result[$data['id']] = $data;
		}
		return $result;
	}
	
	function databaseSetEmailSent($email) {
		$timeNow = date("Y-m-d H:i:s");
		mysql_query("UPDATE emails SET sent='".$timeNow."' WHERE id='".$email['id']."'");
		print "+";
	}
?>